package com.hanyi.ssm.controller;

import com.hanyi.ssm.domain.Account;
import com.hanyi.ssm.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class SsmController {
    @Autowired
    AccountService accountService;
    @RequestMapping("/hello")
    public String hello(Integer id, HttpServletRequest request){
        return "main";
    }

    @RequestMapping("/findall")
    public String findall(Integer id, HttpServletRequest request){
        List<Account> list = accountService.list();
        request.setAttribute("list",list);
        return "main";
    }
}
